import upload from '@/utils/upload'
import request from '@/utils/request'


// 查询用户个人信息
export function sendCode(data) {
  return request({
    url: '/auth/sendCode',
    method: 'post',
	data: data
  })
}

export function login(data) {
  return request({
    url: '/auth/app',
    method: 'post',
	data: data
  })
}

export function getHomeRecmend(data) {
  return request({
    url: '/system/app/work/index',
    method: 'get',
	params: data
  })
}

export function billPay(data) {
  return request({
    url: '/system/bill/pay',
    method: 'post',
	data: data
  })
}

export function authors(workId) {
  return request({
    url: '/system/works/authors/'+workId,
    method: 'get',
  })
}

export function billList() {
  return request({
    url: '/system/bill/list',
    method: 'get',
  })
}


export function getItemContent(itemId) {
  return request({
    url: '/system/app/work/item/content/'+itemId,
    method: 'get',
  })
}

export function getItemWork(workId) {
  return request({
    url: '/system/app/work/item/'+workId,
    method: 'get',
  })
}

export function getItemDetail(workId) {
  return request({
    url: '/system/app/work/'+workId,
    method: 'get',
  })
}


export function addFlow(data) {
  return request({
    url: '/system/flow',
    method: 'post',
	data
  })
}

export function addCollect(data) {
  return request({
    url: '/system/collection',
    method: 'post',
	data
  })
}

export function getCollect(data) {
  return request({
    url: '/system/collection',
    method: 'get',
	params: data
  })
}

export function getCommpent(workItemId) {
  return request({
    url: '/system/app/work/comment/'+workItemId,
    method: 'get',
  })
}

export function addCommpent(data) {
  return request({
    url: '/system/app/work/comment',
    method: 'post',
	data
  })
}

export function getFlow(data) {
  return request({
    url: '/system/flow',
    method: 'get',
	params: data
  })
}

export function reward(itemId) {
  return request({
    url: '/system/app/work/reward/'+itemId,
    method: 'put',
  })
}


export function searchCate() {
  return request({
    url: '/system/app/work/cate',
    method: 'get',
  })
}

export function searchTop(data) {
  return request({
    url: '/system/app/work/top',
    method: 'get',
	params: data
  })
}

export function searchKeyword(data) {
  return request({
    url: '/system/app/work/search',
	method: 'get',
	params: data,
	})}
	
// 查询用户个人信息
export function getPageDetail(id) {
  return request({
    url: '/system/app/work/'+id,
    method: 'get',
  })
}


export function getGoodsList(data) {
  return request({
    url: '/system/app/work/goods/List/',
    method: 'get',
	params: data,
  })
}

export function getViews(data) {
  return request({
    url: '/system/views',
    method: 'get',
		params: data,
  })
}

export function delViews(ids) {
  return request({
    url: '/system/views/'+ids,
    method: 'post',
  })
}

export function getGoodsDetail(data) {
  return request({
    url: '/system/app/work/goods/Detail/',
    method: 'get',
	params: data,
  })
}

export function getInfo(data) {
  return request({
    url: '/system/info',
    method: 'get',
  })
}

export function getBg(data) {
  return request({
    url: '/system/background',
    method: 'get',
  })
}


export function saveInfo(data) {
  return request({
    url: '/system/info',
    method: 'post',
	data
  })
}

export function itemLike(itemId) {
  return request({
    url: '/system/dot/'+itemId,
    method: 'post',
  })
}

export function likes(data) {
  return request({
    url: '/system/dot',
    method: 'get',
	params:data
  })
}
// 修改用户个人信息
export function updateUserProfile(data) {
  return request({
    url: '/system/user/profile',
    method: 'put',
    data: data
  })
}

// 用户头像上传
export function uploadAvatar(data) {
  return upload({
    url: '/system/user/profile/avatar',
    name: data.name,
    filePath: data.filePath
  })
}
